<?php

namespace app\admin\controller\openapi;

use app\common\controller\Backend;
use think\Db;

/**
 * 开放平台
 *
 * @icon fa fa-circle-o
 */
class Setting extends Backend
{
    public function _initialize()
    {
        parent::_initialize();
        // $this->model = model('Config');

    }
    /**
     * 开放平台设置
     */
    public function index()
    {
        $admin = db::table('fa_admin')->where('id', $this->auth->id)->find();
        $this->assign('admins', $admin);
        return $this->view->fetch();
    }
    /**
     * 重置秘钥
     */
    public function createSecret()
    {
        $api_token = md5(md5(time() . '5252525'));
        db::table('fa_admin')->where('id', $this->auth->id)->update(['api_token' => $api_token]);
        return $this->success('重置成功', '', $api_token);
    }
}
